<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
 <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
 <TITLE>The VFLib Graph Matching Library, version 2.0: Installing VFLib </TITLE>
 <LINK HREF="vflib-5.html" REL=next>
 <LINK HREF="vflib-3.html" REL=previous>
 <LINK HREF="vflib.html#toc2" REL=contents>
</HEAD>
<BODY>
<A HREF="vflib-5.html">Next</A>
<A HREF="vflib-3.html">Previous</A>
<A HREF="vflib.html#toc2">Contents</A>
<HR>
<H2><A NAME="Installing"></A> <A NAME="s2">2. Installing VFLib </A></H2>

<P>The VFLib library is distributed in source format, packed and
compressed in a <CODE>.tar.gz</CODE> or in a <CODE>.zip</CODE> format file. 
This means that the first step
for installation is to unpack the archive, but probably you have already
done this, if you are reading this documentation!
<P>Now, you have to compile the library, which requires a C++ compiler.
The library has been developed under the Linux operating system, using
the <CODE>egcs</CODE> compiler. However, the code does make use only of standard
C++ features, so it should work on other operating systems with any recent 
compiler.
<P>For Unix systems like Linux we have provided a Makefile that automates the
compilation process. You need to edit the file <CODE>Makefile</CODE> 
in order to set the name of your compiler and the relevant compile options
(the file provided assumes that the compiler is invoked as <CODE>g++</CODE> and
enables full code optimization); after that you only have to issue the
command <CODE>make</CODE> to build the library.
<P>This will produce a library file named <CODE>libvf.a</CODE> in the <CODE>lib</CODE> 
subdirectory. You will need to link this library to your programs
for using the graph matching library. 
You must also remember, when compiling C++ files that use
the library, to add the <CODE>include</CODE> directory, created when unpacking
the library archive, to the compiler include path.
<P>For example, suppose you have a file named <CODE>my_prog.cc</CODE> which
makes use of the library, and suppose that you have unpacked
and built VFLib under the directory 
<CODE>/usr/local/vflib/</CODE>.
Then the command to produce an object file <CODE>my_prog.o</CODE> would be:
<BLOCKQUOTE>
<HR>
<PRE>
  g++ -c -I/usr/local/vflib/include my_prog.cc
</PRE>
<HR>
</BLOCKQUOTE>

where the <CODE>-c</CODE> flag tells the compiler to stop after producing
the object file, and the <CODE>-I</CODE> flag adds the specified directory
to the include path.
<P>The command to produce an executable would be:
<BLOCKQUOTE>
<HR>
<PRE>
  g++ -o my_prog my_prog.o -L/usr/local/vflib/lib -lvf -lstdc++ -lm
</PRE>
<HR>
</BLOCKQUOTE>

where the <CODE>-o</CODE> flag specifies the name of the executable 
(the default would be <CODE>a.out</CODE>), the <CODE>-L</CODE> flag adds the
<CODE>lib</CODE> directory to the library search path, and the three
<CODE>-l</CODE> flags indicate the libraries to link to the program 
(<CODE>-lvf</CODE> represents the VFLib library file).
<P>
<P>In section 
<A HREF="vflib-5.html#QuickTour">Using VFLib: a quick tour</A> 
you will find some example programs that make use the library.
<P>If you use a non-Unix system, please refer to your compiler
documentation (or ask a local guru) for building the library
and linking it to your programs. Notice that on some compilers
it may be necessary to change the source filenames extension
from <CODE>.cc</CODE> to <CODE>.cpp</CODE> to compile them in C++ mode (as opposed
to C). 
<P>
<P>
<P>
<P>
<HR>
<A HREF="vflib-5.html">Next</A>
<A HREF="vflib-3.html">Previous</A>
<A HREF="vflib.html#toc2">Contents</A>
</BODY>
</HTML>
